package com.quartet.modules.terminal.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.quartet.api.PageResult;
import com.quartet.modules.terminal.dao.TFlowCardInfoDao;
import com.quartet.modules.terminal.dto.TFlowCardInfoQueryRequestDto;
import com.quartet.modules.terminal.dto.TFlowCardInfoResponseDto;
import com.quartet.modules.terminal.entity.TFlowCardInfo;
import com.quartet.modules.terminal.service.TFlowCardInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 流量卡信息表(TFlowCardInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-06-14 09:20:39
 */
@Service("tFlowCardInfoService")
public class TFlowCardInfoServiceImpl extends ServiceImpl<TFlowCardInfoDao, TFlowCardInfo> implements TFlowCardInfoService {

    /**
     * 分页查询流量卡信息
     *
     * @param tFlowCardInfoQueryRequestDto
     * @return
     */
    @Override
    public PageResult<TFlowCardInfoResponseDto> selectFlowCardPage(TFlowCardInfoQueryRequestDto tFlowCardInfoQueryRequestDto) {
        Page p = PageHelper.startPage(tFlowCardInfoQueryRequestDto.getCurrent(), tFlowCardInfoQueryRequestDto.getLimit());
        List<TFlowCardInfoResponseDto> tFlowCardInfoResponseDtoList = this.baseMapper.selectFlowCardPage(tFlowCardInfoQueryRequestDto);
        PageResult<TFlowCardInfoResponseDto> pageResult = new PageResult<>();
        pageResult.setTotal(p.getTotal());
        pageResult.setData(tFlowCardInfoResponseDtoList);
        return pageResult;
    }
}
